import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import greenfoot.GreenfootImage.*;
import java.awt.*;
public class Lebensbalken extends Actor
{

    int lebenskraft = 100;
    String txt;

    public Lebensbalken(String t)
    {
        txt = t;
        zeichnen(lebenskraft);
    }

    public void zeichnen(int z) {
        lebenskraft = z;
        GreenfootImage img = new GreenfootImage(105,35);
        img.drawString(txt,35,29);
        img.setColor(new Color(255,0,0));
        img.drawRect(0,0,100,10);
        img.fillRect(0,0,lebenskraft,10);
        setImage(img);

    }

   

}
